home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / _fixunsd.s < prev    next >
Text File  |  1992-01-15  |  630b  |  31 lines

  1. # double float to unsigned long conversion routine
  2. # mjr: simplified
  3. # does not really return unsigned long: max result is 0x7fffffff instead
  4. # of 0xffffffff    (as in the original routine)
  5. # arg < 0  =>  result = 0
  6. #
  7. comm =     -6
  8. resp =    -16
  9. zahl =      0
  10.  
  11.     .text
  12.     .even
  13.     .globl    __fixunsdfsi, ___fixunsdfsi
  14.  
  15. __fixunsdfsi:
  16. ___fixunsdfsi:
  17.     lea    0xfffa50,a0
  18.     tstl    a4@(4)            | negative?
  19.     bne    Negative
  20.     movew    #0x5403,a0@(comm)    | fintrz to fp0
  21.     cmpiw    #0x8900,a0@(resp)    | check fpu
  22.     movel    a7@(4),a0@
  23.     movel    a7@(8),a0@
  24.     movew    #0x6000,a0@(comm)    | result to d0
  25.     .long    0x0c688900, 0xfff067f8    | wait for fpu
  26.     movel    a0@,d0
  27.     rts
  28. Negative:
  29.     clrl    d0
  30.      rts
  31.